Today we explore an interesting raster and vector data related to Japan. There are several interesting point to observe:

With those in mind let’s begin.

Data preparation

I use simple feature (sf) objects as they allow tidyverse manipulations. For more info on those please refer to this book

library(tidyverse)
library(ggrepel)
library(lubridate)
library(maptools)
library(ggpubr)
library(ggmap)
library(leaflet)
library(rgdal)
library(raster)
library(sf)
library(stringr)

bnd <- read_sf("gm-jpn-all_u_2_2/gm-jpn-all_u_2_2/polbnda_jpn.shp")

prefectures <- bnd %>%
  dplyr::select(nam, laa) %>%
  as.data.frame() %>%
  dplyr::select(-geometry)

bnd <- bnd %>%
  filter(pop > 0) %>%
  group_by(laa) %>%
  summarise(pop = sum(pop))

rails <- read_sf("gm-jpn-all_u_2_2/gm-jpn-all_u_2_2/raill_jpn.shp")
roads <- read_sf("gm-jpn-all_u_2_1/gm-jpn-all_u_2_1/roadl_jpn.shp")
airport <- read_sf("gm-jpn-all_u_2_2/gm-jpn-all_u_2_2/airp_jpn.shp")

dir("gm-jpn-lu_u_1_1/gm-jpn-lu_u_1_1/jpn")
## [1] "lu.aux"      "lu.tfw"      "lu.tif"      "Read_me.txt"
#Those classifications are from 2006
#V 1.1
lu <- raster('gm-jpn-lu_u_1_1/gm-jpn-lu_u_1_1/jpn/lu.tif')
lc <- raster('gm-jpn-lc_u_1_1/gm-jpn-lc_u_1_1/jpn/lc.tif')
elev <- raster('gm-jpn-el_u_1_1/gm-jpn-el_u_1_1/jpn/el.tif')

Data and methods

Few of my first impressions of the vector and raster data: * The polylines of both roads and rails only highlight major transport lines. * The the buildup category of the land classification (LC) underestimated the area compared to the land use (LU) raster, both from 2006. * Some of the wards (municipalities) have no raster values for buildup area.

Having these in mind I implemented the following logic to derive the transport hub and urban density products:

  1. A good approximation of how much of a transport hub a municipality is, is the length of linear kilometers of roads or rails per square kilometers of ward area.
  2. The buildup percentage is derived by extracting the extent of the ward from the land use vector. Then presence of all classes is assessed in terms of percentages. I have computed urban density only for wards that have more than 20 % buildup area. For the calculation itself I take the population / percentage of buildup * total area in sq km.The result is then population density in the urban areas fo respective wards.
## although coordinates are longitude/latitude, st_intersects assumes that they are planar
## although coordinates are longitude/latitude, st_intersects assumes that they are planar

Plotting

Population

The following map signifies where most of the population lives. The administrative unit is ward.

Urban density

The map below show the wards which have more than 20% build up area (as per LU classification from 2006). The color highlights the population density in their urban areas. NB: LU is now 12 years old. Population data is from 2016. The popups will show you how much people are estimated to live in a square km, as well as the name of the ward.

Transport hubs

Using the methods described above I also present to you the distribution of transport lines (roads and rail tracks) among the wards across Japan.